//============================================================================
// Name        : csiena
// Author      : Josh Lospinoso
// Copyright   : MIT License
// Description : Austere, limited implementation of the R package RSiena in
//				 C++. Used for fast maximum likelihood and method of moments
//				 estimation of stochastic actor oriented models (SAOMs)
//				 without any frills or user experience niceties.
//============================================================================

#ifndef LINK_H_
#define LINK_H_
#include "globals.h"
#include "chainElement.h"
#include "linkEvaluation.h"

namespace csiena {

class ChainLink : public csiena::ChainElement {
public:
	// Initializer methods
	virtual ~ChainLink();
	ChainLink(int actors);
	ChainLink(const ChainLink &donorLink);

	// Evaluation related methods
	void preprocess(Digraph *x, Evaluation* f);
	void evaluate(Digraph* x, Evaluation* f);
	double evaluateProposal(Digraph* x, Evaluation* f);

	// Utility methods
	void simulate(Digraph *x, LinkEvaluation* f, MersenneTwister* r);
	void print(int index);
	bool isLink();

	// Accessor Methods
	double getScore(int a);
	double getInformation(int a, int b);
	double getChangeStatsForAlter(int k, int j);
	double getChangeStats(int k);
	double getLogProbability();

	// Ingredients for chain
	int i;
	int j;

private:
	int actors;
	double logProbability;
	double* score;
	double* information;
	double* changeStats;
	double* notionalScores;
};

}

#endif /* LINK_H_ */
